package com.itboye.lottery.retrofit;

import com.itboye.lottery.bean.AddressBean;
import com.itboye.lottery.bean.AppConfigBean;
import com.itboye.lottery.bean.BalanceBean;
import com.itboye.lottery.bean.BetBean;
import com.itboye.lottery.bean.BetDetailBean;
import com.itboye.lottery.bean.BetZqDetailBean;
import com.itboye.lottery.bean.ColorBallPrizeHisBean;
import com.itboye.lottery.bean.FindBean;
import com.itboye.lottery.bean.FollowIndexBean;
import com.itboye.lottery.bean.FollowOrderDetailBean;
import com.itboye.lottery.bean.HistoryPrizeBean;
import com.itboye.lottery.bean.HotPeoleDetail;
import com.itboye.lottery.bean.IndexDataBean;
import com.itboye.lottery.bean.JinEDetail;
import com.itboye.lottery.bean.MessageBean;
import com.itboye.lottery.bean.MyFollowDetailBean;
import com.itboye.lottery.bean.NoticeBean;
import com.itboye.lottery.bean.OrderBean;
import com.itboye.lottery.bean.OutWrapBean;
import com.itboye.lottery.bean.PaySupportBean;
import com.itboye.lottery.bean.PeopleBean;
import com.itboye.lottery.bean.UserDataBean;
import com.itboye.lottery.bean.ZhuiHaoDetailBean;
import com.itboye.lottery.bean.ZqMatchDataCheck;

import java.util.ArrayList;
import java.util.List;

import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import rx.Observable;


/**
 * Created by YJY on 2017/10/12.
 */

public interface RetrofitInterface {

    //用户微信登录1.2
    @FormUrlEncoded
    @POST("weixin/app_login")
    Observable<HttpResponse<UserDataBean>> login(@Field("user_info") String wxCode, @Field("mobile") String phone, @Field("invite_code") String invite_code, @Field("mobile_code") String mobileCode);

    //用户微信登录1.2
    @FormUrlEncoded
    @POST("user_info/update")
    Observable<HttpResponse<String>> updateUserInfo(@Field("nick") String nick);

    //发送验证码
    @FormUrlEncoded
    @POST("sms/send_code")
    Observable<HttpResponse<String>> sendCode(@Field("type") int type, @Field("mobile") String phone);

    //绑定手机号
    @FormUrlEncoded
    @POST("user_info/bind_phone")
    Observable<HttpResponse<String>> bindPhone(@Field("mobile") String phone, @Field("code") String code);

    //绑定手机号
    @FormUrlEncoded
    @POST("user_info/change_phone")
    Observable<HttpResponse<String>> updatePhone(@Field("new_mobile") String phone, @Field("new_mobile_code") String code);

    @Multipart
    @POST("file/upload_avatar")
    Observable<HttpResponse<String>> uploadAvatar(@Part MultipartBody.Part file);


    //首页数据
    @POST("Index/index")
    Observable<HttpResponse<IndexDataBean>> homeIndex();

    //投注记录
    @GET("BettingLog/bet_list")
    Observable<HttpResponse<List<BetBean>>> getBetList(@Query("key") int type, @Query("page") int page);

    //意见反馈
    @FormUrlEncoded
    @POST("feedback/feedback")
    Observable<HttpResponse<String>> feedback(@Field("content") String content);

    /**
     * 消息中心
     *
     * @param readStatus
     * @return
     */
    @FormUrlEncoded
    @POST("message/query")
    Observable<HttpResponse<List<MessageBean>>> messageQuery(@Field("read_status") int readStatus, @Field("page") int page);

    /**
     * 地址查询
     *
     * @param addressId
     * @return
     */
    @FormUrlEncoded
    @POST("UserAddress/index")
    Observable<HttpResponse<AddressBean>> getAddressList(@Field("address_id") String addressId);

    /**
     * 地址更新
     *
     * @return
     */
    @FormUrlEncoded
    @POST("UserAddress/update")
    Observable<HttpResponse<String>> updateAddress(@Field("address_id") String address_id, @Field("name") String consigneeName, @Field("phone") String consigneeMobile, @Field("province") String province, @Field("city") String city, @Field("district") String district, @Field("address") String pcd, @Field("is_default") String isDefault);

    /**
     * 地址添加
     *
     * @return
     */
    @FormUrlEncoded
    @POST("UserAddress/update")
    Observable<HttpResponse<String>> addAddress(@Field("name") String consigneeName, @Field("phone") String consigneeMobile, @Field("province") String province, @Field("city") String city, @Field("district") String district, @Field("address") String pcd, @Field("is_default") String isDefault);

    /**
     * 地址删除
     *
     * @return
     */
    @FormUrlEncoded
    @POST("UserAddress/delete")
    Observable<HttpResponse<String>> deleteAddress(@Field("address_id") String address_id);

    /**
     * 选择邮寄地址
     *
     * @return
     */
    @FormUrlEncoded
    @POST("UserAddress/choiceaddress")
    Observable<HttpResponse<String>> chooseAddress(@Field("address_id") String addressId);


    /**
     * 获取用户可提现余额
     *
     * @return
     */
    @POST("Usermoney/withdrawals")
    Observable<HttpResponse<BalanceBean>> getWithdrawalBalance();

    //双色球开奖历史
    @POST("color_ball/prize_his")
    Observable<HttpResponse<ColorBallPrizeHisBean>> colorBallPrizeHistory();

    //大乐透开奖历史
    @POST("lotto/prize_his")
    Observable<HttpResponse<ColorBallPrizeHisBean>> daLeTouPrizeHistory();

    /**
     * 大乐透彩票投注订单生成
     *
     * @param num
     * @param multiple
     * @param push_number
     * @param is_rand
     * @param is_stop
     * @param stop_money
     * @return
     */
    @FormUrlEncoded
    @POST("lotto/create_order")
    Observable<HttpResponse<OrderBean>> createOrderForDaLeTou(@Field("num") String num, @Field("multiple") int multiple, @Field("push_number") String push_number, @Field("is_rand") int is_rand, @Field("is_stop") int is_stop, @Field("stop_money") int stop_money);

    /**
     * 双色球彩票投注订单生成
     *
     * @param num
     * @param multiple
     * @param push_number
     * @param is_rand
     * @param is_stop
     * @param stop_money
     * @return
     */
    @FormUrlEncoded
    @POST("color_ball/create_order")
    Observable<HttpResponse<OrderBean>> createOrderForColorBall(@Field("num") String num, @Field("multiple") int multiple, @Field("push_number") String push_number, @Field("is_rand") int is_rand, @Field("is_stop") int is_stop, @Field("stop_money") int stop_money);

    /**
     * 获取可用支付方式
     *
     * @return
     */
    @POST("pay/support")
    Observable<HttpResponse<List<PaySupportBean>>> paySupport();

    @POST("football/match")
    Observable<HttpResponse<Object>> geFootBallMatch();

    @POST("basketball/match")
    Observable<HttpResponse<Object>> getBasketballMatch();

    //足球投注
    @FormUrlEncoded
    @POST("football/create_order")
    Observable<HttpResponse<OrderBean>> zqCreateOrder(@Field("num") String num, @Field("origin_num") String origin_num, @Field("multiple") int multiple, @Field("free_pass") String passType, @Field("order_type") String order_type);

    //篮球投注
    @FormUrlEncoded
    @POST("basketball/create_order")
    Observable<HttpResponse<OrderBean>> lqCreateOrder(@Field("num") String num, @Field("origin_num") String origin_num, @Field("multiple") int multiple, @Field("free_pass") String passType, @Field("order_type") String order_type);

    @FormUrlEncoded
    @POST("UserMoney/pay")
    Observable<HttpResponse<String>> pay(@Field("sn") String sn, @Field("money") double amount);

//    @FormUrlEncoded
//    @POST("UserMoney/recharge")
//    Observable<HttpResponse<OrderBean>> chongzhi(@Field("money") double money);

    /**
     * 数字彩详情
     *
     * @return
     */
    @GET("BettingLog/bet_list_info")
    Observable<HttpResponse<BetDetailBean>> betShuZiCaiDetail(@Query("id") String id);

    //足球彩
    @GET("BettingLog/sports_detail")
    Observable<HttpResponse<BetZqDetailBean>> betZqCaiDetail(@Query("id") String id);

    /**
     * @param account_type        weixin,alipay,bank 3种
     * @param owner_name          银行卡持有人姓名（当是bank类型时才传）
     * @param bank_branch_address 银行卡开户行地址
     * @param money               提现金额
     * @param account             提现账户
     * @return
     */
    @FormUrlEncoded
    @POST("UserMoney/apply")
    Observable<HttpResponse<String>> tixianShenQing(@Field("money") String money, @Field("account") String account,
                                                    @Field("account_type") String account_type,
                                                    @Field("owner_name") String owner_name,
                                                    @Field("bank_branch_address") String bank_branch_address);

    @FormUrlEncoded
    @POST("UserMoney/detailed")
    Observable<HttpResponse<ArrayList<JinEDetail>>> mingxi(@Field("type") int type, @Field("page") int page);

    @GET("DrawNotice/notice")
    Observable<HttpResponse<NoticeBean>> getNotice();

    @GET("DrawNotice/detail")
    Observable<HttpResponse<NoticeBean.NoticeItem>> getNoticeDetail(@Query("id") String id);

    @FormUrlEncoded
    @POST("DrawNotice/ballinfo")
    Observable<HttpResponse<ArrayList<NoticeBean.NoticeItem>>> getNoticeZqDetail(@Field("type") String ball_type, @Field("open_time") long open_time);

    //大乐透开奖历史
    @POST("lotto/prize_his")
    Observable<HttpResponse<HistoryPrizeBean>> getHistoryPrize();

    //双色球开奖历史
    @POST("color_ball/prize_his")
    Observable<HttpResponse<HistoryPrizeBean>> getSsqHistoryPrize();

    @GET("UserMoney/available")
    Observable<HttpResponse<Double>> getAvailableBalance();

    @GET("Found/wanfajihe")
    Observable<HttpResponse<ArrayList<FindBean>>> getPlayCenter();

    @GET("Found/news")
    Observable<HttpResponse<ArrayList<FindBean>>> getNews(@Query("page") int page);

    @GET("Found/notice")
    Observable<HttpResponse<ArrayList<FindBean>>> getNewsNotice(@Query("page") int page);

    @GET("Found/huodong")
    Observable<HttpResponse<ArrayList<FindBean>>> getAtivities(@Query("page") int page);

    @FormUrlEncoded
    @POST("followOrder/addPlan")
    Observable<HttpResponse<OrderBean>> faqigendan(@Field("lottery_type") int lottery_type, @Field("num") String num, @Field("origin_num") String orignNum, @Field("multiple") int multiple, @Field("free_pass") String pass_type,
                                                   @Field("type") int type, @Field("public_type") int public_type, @Field("reason") String reason, @Field("low_amount") String low_amount,
                                                   @Field("ensure_odds") String ensure_odds);

    @GET("FollowOrder/followIndex")
    Observable<HttpResponse<FollowIndexBean>> getFollowIndex(@Query("sort") int sort, @Query("page") int page, @Query("page_size") int page_size, @Query("is_follow") int is_follow);

    @GET("FollowOrder/redList")
    Observable<HttpResponse<ArrayList<PeopleBean>>> getHotPeopleList(@Query("page") int plan_id, @Query("page_size") int num);

    @FormUrlEncoded
    @POST("followOrder/followPlan")
    Observable<HttpResponse<OrderBean>> followCase(@Field("plan_id") int plan_id, @Field("num") int num);

    /**
     * 大神主页
     *
     * @param hotPeopleId
     * @param type
     * @param page
     * @param size
     * @return
     */
    @GET("FollowOrder/godIndex")
    Observable<HttpResponse<HotPeoleDetail>> getHotPeopleDetail(@Query("uid") String hotPeopleId, @Query("type") int type, @Query("page") int page, @Query("page_size") int size);

    //我的跟单
    @FormUrlEncoded
    @POST("FollowOrder/followPlanList")
    Observable<HttpResponse<ArrayList<BetBean>>> myGenDan(@Field("type") int type, @Field("page") int page, @Field("page_size") int size);

    //我的推荐
    @FormUrlEncoded
    @POST("FollowOrder/myPlanList")
    Observable<HttpResponse<ArrayList<BetBean>>> myTuiJian(@Field("type") int type, @Field("page") int page, @Field("page_size") int size);

    @GET("FollowOrder/godOrderDetail")
    Observable<HttpResponse<FollowOrderDetailBean>> getDaShenFollowDetail(@Query("orderId") String orderId);

    @FormUrlEncoded
    @POST("FollowOrder/followPlanDetail")
        //跟单详情
    Observable<HttpResponse<MyFollowDetailBean>> getFollowDetail(@Field("orderId") String orderId, @Field("lu_id") String lUid);

    //发单详情
    @FormUrlEncoded
    @POST("FollowOrder/myPlanDetail")
    Observable<HttpResponse<FollowOrderDetailBean>> getFaDanDetail(@Field("orderId") String orderId);

    @GET("Found/newsinfo")
    Observable<HttpResponse<FindBean>> newsDetail(@Query("article_id") String articleId);

    @GET("Found/noticeinfo")
    Observable<HttpResponse<FindBean>> huoDongDetail(@Query("article_id") String articalId);

    @GET("Found/huodonginfo")
    Observable<HttpResponse<FindBean>> gongGaoDetail(@Query("article_id") String articalId);

    @GET("Chasing/index")
    Observable<HttpResponse<ArrayList<BetBean>>> getZhuiHaoList(@Query("page") int page);

    //追号详情
    @FormUrlEncoded
    @POST("Chasing/info")
    Observable<HttpResponse<ZhuiHaoDetailBean>> getZhuiHaoDetail(@Field("id") String id);

    //获取App配置信息
    @GET("Config/index")
    Observable<HttpResponse<ArrayList<AppConfigBean>>> getAppConfig();

    //粉丝列表
    @FormUrlEncoded
    @POST("FollowOrder/followList")
    Observable<HttpResponse<OutWrapBean>> getMyAttentionList(@Field("page") int page, @Field("page_size") int pageSize, @Field("follow") int follow);

    //关注/取消关注
    @FormUrlEncoded
    @POST("FollowOrder/follow")
    Observable<HttpResponse<String>> follow(@Field("uid") int id, @Field("status") int status);

    @POST("UserMoney/follow")
    Observable<HttpResponse<UserDataBean>> getMyLotteryFragmentData();

    @FormUrlEncoded
    @POST("football/verify")
    Observable<HttpResponse<ZqMatchDataCheck>> getFootBallMathDataCheck(@Field("num") String num, @Field("multiple") int multiple, @Field("free_pass") String free_pass);

    @FormUrlEncoded
    @POST("basketball/verify")
    Observable<HttpResponse<ZqMatchDataCheck>> getBasketballMathDataCheck(@Field("num") String num, @Field("multiple") int multiple, @Field("free_pass") String free_pass);

    @FormUrlEncoded
    @POST("gr_pay/lottery_alipay_h5")
    Observable<HttpResponse<String>> zfbH5GrPay(@Field("sn") String sn, @Field("coupon_id") String coupon_id, @Field("pay_type") String payType, @Field("return_url") String return_url);

    @FormUrlEncoded
    @POST("gr_pay/recharge")
    Observable<HttpResponse<String>> chongzhiByGr(@Field("sn") String sn, @Field("amount") double amount, @Field("oauth") String oauth, @Field("pay_type") String pay_type, @Field("return_url") String return_url);


    @FormUrlEncoded
    @POST("fs_pay/lottery_alipay_h5")
    Observable<HttpResponse<String>> zfbH5Pay(@Field("sn") String sn, @Field("coupon_id") String coupon_id, @Field("pay_type") String payType, @Field("return_url") String return_url);

    @FormUrlEncoded
    @POST("fs_pay/recharge")
    Observable<HttpResponse<String>> chongzhiByFs(@Field("sn") String sn, @Field("amount") double amount, @Field("oauth") String oauth, @Field("pay_type") String pay_type, @Field("return_url") String return_url);

    @FormUrlEncoded
    @POST("bonus/optimize")
    Observable<HttpResponse<ArrayList<ArrayList<String>>>> optimize(@Field("type") String type, @Field("cost") float totalMoney, @Field("bonus") String bonus);

    @FormUrlEncoded
    @POST("weixin/is_register")
    Observable<HttpResponse<UserDataBean>> isRegister(@Field("code") String wxcode);

    @FormUrlEncoded
    @POST("user_account/login")
    Observable<HttpResponse<UserDataBean>> loginByPhone(@Field("mobile") String phone, @Field("mobile_code") String code);

    @FormUrlEncoded
    @POST("user_account/register")
    Observable<HttpResponse<UserDataBean>> registerByPhone(@Field("mobile") String phone, @Field("mobile_code") String code, @Field("invite_code") String inviteCode);
}